package com.wens.baselibrary.view.activity

import android.content.Context
import com.blankj.utilcode.util.AppUtils
import com.blankj.utilcode.util.BarUtils
import com.blankj.utilcode.util.ThreadUtils
import com.wens.baselibrary.R
import com.wens.baselibrary.databinding.ActivityLaunchBinding
import com.wens.baselibrary.present.LaunchPresent

abstract class LaunchActivity : BaseActivity<LaunchPresent>() {

    override fun onStop() {
        super.onStop()
        finish()
    }

    override fun initData(context: Context) {
        setTheme(R.style.LaunchTheme)
        ThreadUtils.runOnUiThreadDelayed({
            startActivity(present.getNextActivityIntent())
        }, 500)
    }

    override fun initView(context: Context) {
        val binding: ActivityLaunchBinding = ActivityLaunchBinding.inflate(layoutInflater)
        setContentView(binding.root)
        if (BarUtils.isNavBarVisible(this)) {
            binding.root.setBackgroundResource(R.drawable.launch_bg_navigation_bar_show)
        }
    }

}